<template>
  <div class="employees-container">
    <div class="app-container">
      <el-card>
        <el-tabs v-model="selected">
          <el-tab-pane label="登录账户设置" name="login">
            <LoginSetting :user-info="userInfo"></LoginSetting>
          </el-tab-pane>
          <el-tab-pane label="个人详情" name="detail">
            <UserInfo :user-info="userInfo"></UserInfo>
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>
<script>
import LoginSetting from './components/login-setting.vue'
import UserInfo from './components/userInfo.vue'
import { getUserDetailById } from '@/api/user.js'
export default {
  name: 'Detail',
  components: {
    LoginSetting,
    UserInfo
  },
  data () {
    return {
      // 默认选中的页签
      selected: 'detail',
      userInfo: {}
    }
  },
  created () {
    this.getUserDetailById()
  },
  methods: {
    async getUserDetailById () {
      const data = await getUserDetailById(this.$route.params.id)
      // console.log(data)
      this.userInfo = data
    }
  }
}
</script>

